package day06;

import javax.swing.plaf.metal.MetalInternalFrameTitlePane;
import java.util.Arrays;

public class HomeWork1 {
    public static void main(String[] args) {
        double a=getNum();
        System.out.println(a);
        int b=plus(5,6);
        System.out.println(b);
        int m=5,n=6;
        int c=plus(m,n);
        System.out.println(c);
        int[] d=testArray(5, 100);
        System.out.println("数组的长度为："+d.length);
        for (int i=0;i<d.length;i++){
            System.out.println(d[i]);
        }
        int[] e=testArray(8, 20);
        System.out.println("第一个元素的值为："+e[0]);
        for (int i=0;i<e.length;i++){
            System.out.println(e[i]);
        }
        /*
        say();
        sayHi("zsy");
        sayHello("zsy",29);
         */
        /*
        int[]arr=new int[10];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }
        int max=arr[0];
        for (int i=1;i<arr.length;i++){
            if (arr[i]>max){
                max=arr[i];
            }
        }
        System.out.println("最大值为："+max);
        arr= Arrays.copyOf(arr,arr.length+1);
        arr[arr.length+1]=max;
        for (int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        */
    }
    /*public static void say(){
        System.out.println("大家好，我叫zsy，今年29岁");
        }
    public static void sayHi(String name){
        System.out.println("大家好，我叫"+name+"，今年29岁");
    }
    public static void sayHello(String name,int age){
        System.out.println("大家好，我叫"+name+"，今年"+age+"岁");
    }
     */
    public static double getNum(){
        return 9.99;
    }
    public static int plus(int num1, int num2){
        int num=num1+num2;
        return  num;
    }
    public static int[] testArray(int len,int max){
        int[]arr=new int[len];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int) (Math.random()*(max+1));
        }
        return arr;
    }

}
